package com.cke.yang.preview.api.controller;

import com.cke.yang.common.domain.model.Result;
import com.cke.yang.preview.app.service.PrevApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 预览控制器
 *
 * @author yuyang
 * @date 2025-11-18 00:00:00
 */
@RestController
@RequestMapping("/api/preview/prev-api")
public class PrevApiController {

    @Autowired
    private PrevApiService prevApiService;

    /**
     * 链接交换接口
     *
     * @param mode 模式
     * @param keyBase64 密钥Base64
     *                  
     * @return 预览结果
     */
    @GetMapping("/exchange-link")
    public Result<?> exchangeLink(@RequestParam("mode") String mode, @RequestParam("keyBase64") String keyBase64) {
        return Result.success(prevApiService.exchangeLink(mode, keyBase64));
    }

}
